/**
 * 会员消费记录
 */
export interface ConsumptionRecord {
  id: number;
  orderNo: string;
  amount: number;
  date: string;
}

/**
 * 会员信息
 */
export interface Member {
  id: number;
  name: string;
  phone: string;
  email?: string;
  avatar: string;
  level: string;
  level_id?: number;
  balance: number;
  points: number;
  status: number; // 1: 正常, 0: 禁用
  description?: string;
  joinDate: string;
  created_at?: number;
  last_login_at?: number;
  last_consume_time?: number;
  consume_count?: number;
  consumptionRecords: ConsumptionRecord[];
}

/**
 * 会员列表查询参数
 */
export interface MemberQuery {
  page: number;
  pageSize: number;
  name?: string;
  phone?: string;
  level?: string;
  status?: number;
}

/**
 * 会员列表响应数据
 */
export interface MemberListData {
  list: Member[];
  total: number;
  statistics?: {
    totalMembers: number;
    activeMembers: number;
    newMembersToday: number;
    averageBalance: number;
  };
}

/**
 * 余额变动记录
 */
export interface BalanceLog {
  id: number;
  member_id: number;
  amount: number;
  before_balance: number;
  after_balance: number;
  type: number; // 1: 充值, 2: 消费, 3: 退款, 4: 管理员调整
  description: string;
  order_no?: string;
  transaction_no?: string;
  operator?: string;
  created_at: number;
}

/**
 * 积分变动记录
 */
export interface PointsLog {
  id: number;
  member_id: number;
  points: number;
  before_points: number;
  after_points: number;
  type: number; // 1: 消费获得, 2: 管理员调整, 3: 活动奖励, 4: 积分兑换, 5: 积分过期
  description: string;
  order_no?: string;
  operator?: string;
  created_at: number;
}

/**
 * 会员卡信息
 */
export interface MemberCard {
  id: number;
  member_id: number;
  card_no: string;
  card_number: string;
  name: string;
  type: number; // 1: 储值卡, 2: 积分卡, 3: 折扣卡, 4: 次卡
  level_id: number;
  level_name?: string;
  theme?: string;
  logo?: string;
  balance: number;
  points: number;
  validity_period: number; // 有效期（月）
  expire_time?: number;
  expiry_date?: number;
  status: number; // 1: 正常, 2: 已过期, 0: 禁用
  description?: string;
  remark?: string;
  last_used_at?: number;
  created_at: number;
}

/**
 * 会员等级
 */
export interface MemberLevel {
  id: number;
  name: string;
  code: string;
  description?: string;
  discount_rate?: number;
  points_ratio?: number;
  status: number;
}

export {}; // 确保该文件被视为一个模块